//提交
function form_submit(form) {
	recoverFlag();
	if (checkHomeworkName(form) & checkDescribe(form)) {
		return true;
	}else{
		return false;
	}
}

//校验作业名
function checkHomeworkName(form) {// 必填； 且必须是英文字母或数字或中文, 长度1-30
	var homeworkName = form.homeworkName;
	var value = form.homeworkName.value;
	var span = document.getElementById("homeworkNameSpanId");
	var regex = /^[a-zA-Z0-9_\u4e00-\u9fa5]{1,30}$/;
	if (regex.test(value)) {
		span.innerHTML="<img src='images/ok.gif'/>";
		return true;
	} else {
		span.innerHTML = "<img src='images/no.gif'/><font color='red'>必填； 且必须是英文字母或数字或中文, 长度1-30</font>";
		homeworkName.focus();
		return false;
	}
}
//校验描述
function checkDescribe(form) {//  长度0-60
	var describe = form.describe;
	var value = form.describe.value;
	var span = document.getElementById("describeSpanId");
	var regex = /^[a-zA-Z0-9_\u4e00-\u9fa5]{0,60}$/;
	if (regex.test(value)) {
		span.innerHTML="<img src='images/ok.gif'/>";
		return true;
	} else {
		span.innerHTML = "<img src='images/no.gif'/><font color='red'>描述过长，请填写0-60个字符</font>";
		describe.focus();
		return false;
	}

}

//重置按钮
function recoverFlag() {
	var span1 = document.getElementById("homeworkNameSpanId");
	var span2 = document.getElementById("describeSpanId");
	span1.innerHTML = "*";
	span2.innerHTML = "";
}